/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.remisharrock.jcoffrefort.login;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.openide.util.Exceptions;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;

/**
 *
 * @author sharrock
 */
public class JsoupTesting {

 private Logger l = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);

    public void test() {
        
        try {
            FileInputStream input = new FileInputStream("C:/Users/sharrock/Documents/NetBeansProjects/jcoffrefort/menuarbo.html");
            DataInputStream in = new DataInputStream(input);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            while ((strLine = br.readLine()) != null) {
                if (strLine.startsWith("d.add(")) {
                    String[] split = strLine.split(",");
                    if (split.length >= 4) {
                        Document parse = Jsoup.parse(split[2].replace('"', ' ').trim());
                        l.info(parse.text());
                        String trim = split[3].replace('"', ' ').trim();
                        String[] split1 = trim.split("XDIR=");
                        if (split1.length >= 2) {
                            l.info("   "+split1[1].trim());
                        }
                    }
                }
               // io.getOut().println(strLine);
            }

        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}
